<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:wb="http://open.weibo.com/wb" class=" widthauto">
<head>

<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-2.0.0.js"></script>
<script type="text/javascript" src="js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="js/select-ui.min.js"></script>
<script type="text/javascript" src="../js/layer/layer.js"></script>
<script type="text/javascript">
	function goPage(a){
		var id = a.id;
		location.href = id;
	}	
	
	function form_submit(){
		$("#postlist").submit();
	}
	
	function deletePost(a){
		var r = confirm("确定删除该帖子吗？");
		if (r==true){
			location.href = "PostAction_deletePost.action?pid="+a.id;
		}
	}

	function updatePostStatus(a){
		var $a = $(a);
		var title = $a.parent().parent().find("td").get(0).innerHTML;
		var userName = $a.parent().parent().find("td").get(1).innerHTML;
		var pid = a.id;
		layer.open({
		  type: 2,
		  title: '审核帖子--'+title,
		  shadeClose: true,
		  shade: 0.2,
		  area: ['250px', '40%'],
		  content: 'postjudge.jsp?pid='+pid //iframe的url
		}); 
	}

	$(document).ready(function() {
		$(".select1").uedSelect({
			width : 345
		});
		$(".select2").uedSelect({
			width : 167
		});
		$(".select3").uedSelect({
			width : 100
		});

		$(".click").click(function() {
			$(".tip").fadeIn(200);
		});

		$(".tiptop a").click(function() {
			$(".tip").fadeOut(200);
		});

		$(".sure").click(function() {
			$(".tip").fadeOut(100);
		});

		$(".cancel").click(function() {
			$(".tip").fadeOut(100);
		});

	});
</script>

</head>

<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">帖子管理</a>
			</li>
			<li><a href="#">帖子列表</a>
			</li>
		</ul>
	</div>

	<div class="rightinfo">
	<form action="PostAction_getPageResult2.action" method="post" id="postlist">
		<ul class="seachform">
			<li><label>标题</label><input name="title" type="text" class="scinput" />
			</li>
			<li><label>发帖用户</label><input name="nickName" type="text"
				class="scinput" />
			</li>


			<li><label>主题</label><input name="topicName" type="text" class="scinput" />
			</li>

			<li><label>帖子状态</label>
				<div class="vocation">
					<select class="select3" name="postStatus">
						<option value="">全部</option>
						<option value="0">未审核</option>
						<option value="1">未通过审核</option>
						<option value="2">通过审核</option>
						<option value="3">加精</option>
					</select>
				</div></li>

			<li><label>&nbsp;</label><input name="" type="button"
				class="scbtn" value="查询" onclick="form_submit()"/>
			</li>

		</ul>
		</form>
		<table class="tablelist">
			<thead>
				<tr>
					<!-- <th><input name="" type="checkbox" value="" checked="checked"/></th> -->
					<th>标题<i class="sort"></i>
					</th>
					<th>发帖用户</th>
					<th>主题</th>
					<th>查看数</th>
					<th>回复数</th>
					<th>发帖时间</th>
					<th>帖子状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<c:forEach items="${page.queryResult }" var="post">
				<tr>
					<td>${post.title }</td>
					<td>${post.nickName }</td>
					<td>${post.topicName }</td>
					<td>${post.viewNumber }</td>
					<td>${post.replyNumber }</td>
					<td>${post.postTime }</td>
					<td>
						<c:if test="${post.postStatus==0 }">未审核</c:if>
						<c:if test="${post.postStatus==1 }">审核未通过</c:if>
						<c:if test="${post.postStatus==2 }">审核通过</c:if>
						<c:if test="${post.postStatus==3 }">加精</c:if>
					</td>
					<td>
						<a href="../main/ReplyAction_singlePost.action?pid=${post.id }&pagenum=1" target="_Blank" class="tablelink">查看</a> 
						<a href="javascript:void(0)" id="${post.id }" onclick="updatePostStatus(this)" class="tablelink">审核</a>
						<a href="javascript:void(0)" id="${post.id }" onclick="deletePost(this)" class="tablelink">删除</a>
					</td>
				</tr>
			</c:forEach>
			</tbody>
		</table>


		<div class="pagin">
			<div class="message">
				共<i class="blue">${page.recordCount }</i>条记录，<i class="blue">${page.pageCount }</i>页，当前显示第&nbsp;<i class="blue">${page.currentPageNo }&nbsp;</i>页
			</div>
			<ul class="paginList">
				<li class="paginItem">
				<c:if test="${page.currentPageNo>1 }">
				    <a id="PostAction_getPageResult2.action?pagenum=${page.currentPageNo-1 }" onclick="goPage(this)">
				    	<span class="pagepre"></span><!-- 上一页 -->
				    </a>
				</c:if>
				</li>
				<li class="paginItem current">
					<a href="javascript:;">${page.currentPageNo }</a>
				</li>
				<li class="paginItem">
				<c:if test="${page.currentPageNo<page.pageCount }">
	    			<a id="PostAction_getPageResult2.action?pagenum=${page.currentPageNo+1 }" onclick="goPage(this)">
	    				<span class="pagenxt"></span>
	    			</a>
	    		</c:if>
				</li>
			</ul>
		</div>


		<div class="tip">
			<div class="tiptop">
				<span>提示信息</span><a></a>
			</div>

			<div class="tipinfo">
				<span><img src="images/ticon.png" />
				</span>
				<div class="tipright">
					<p>是否确认对信息的修改 ？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>

			<div class="tipbtn">
				<input name="" type="button" class="sure" value="确定" />&nbsp; <input
					name="" type="button" class="cancel" value="取消" />
			</div>

		</div>




	</div>
	<script type="text/javascript">
		$(".rightinfo ul").idTabs();
	</script>
	<script type="text/javascript">
		$('.tablelist tbody tr:odd').addClass('odd');
	</script>
</body>
</html>
